package com.itheima.set;

import com.itheima.domain.Student;

import java.util.Comparator;
import java.util.TreeSet;

public class Demo03 {

    public static void main(String[] args) {
        TreeSet<Integer> set = new TreeSet<>();
        set.add(789);
        set.add(123);
        set.add(456);
        set.add(456);
        set.add(110);
        System.out.println(set);

        TreeSet<Student> treeSet = new TreeSet<>(
                new Comparator<Student>() {
                    @Override
                    public int compare(Student o1, Student o2) {
                        return 0;
                    }
                });
        treeSet.add(new Student("蔡徐坤",18));
        treeSet.add(new Student("鹿晗",20));
        treeSet.add(new Student("吴亦凡",31));
        treeSet.add(new Student("黄子韬",29));
        System.out.println(treeSet);
    }
}
